package com.atguigu.spzx.order.controller;

import com.atguigu.spzx.model.vo.api.order.ApiOrderTradeVO;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.order.service.OrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/order/orderInfo")
@Tag(name = "订单模块")
public class OrderController {

    @Resource
    OrderService orderService;
    @Operation(summary = "提交订单")
    @PostMapping("/auth/submitOrder")
    public Result submitOrder(){
        return Result.ok();
    }
    @Operation(summary = "确认下单：商品详情页立即购买按钮")
    @GetMapping("/auth/buy/{skuId}")
    public Result buy(@PathVariable("skuId")Long skuId){
        ApiOrderTradeVO orderTradeVO = orderService.buy(skuId);
        return Result.ok().data(orderTradeVO);
    }

    @Operation(summary = "确认下单：购物车页面点击去结算")
    @GetMapping("/auth/trade")
    public Result trade(){
        ApiOrderTradeVO orderTradeVO = orderService.trade();
        return Result.ok().data(orderTradeVO);
    }

}
